package com.sec.android.app.myfiles.util;

import com.sec.android.app.myfiles.MyFilesTestRunner;

import junit.framework.Assert;

import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * Created by jaebae on 2016-06-08.
 */

@RunWith(MyFilesTestRunner.class)
public class testEmoticonUtils {
    @Test
    public void testHasEmoticon() {
        StringBuilder sb = new StringBuilder();

        String unicodeSample[] = {
                "0x1f602", "0x25FC", "0x25FB", "0x26AB", "0x2651",
                "0x264E", "0x267B", "0x26d4", "0x203c", "0x2683", "0x2747", "0xff1f"
        };

        String nonUnicodeSample[] = {
                "0x25aa", "0x271d", "0x002a", "0x262a"
        };

        for (String unicode : unicodeSample) {
            sb.setLength(0);
            sb.append("testString");
            sb.append(EmoticonUtils.unicodeToUTF16(unicode));
            sb.append("testString");

            boolean bRet = EmoticonUtils.hasEmoticon(sb);

            Assert.assertTrue(bRet);
        }
        sb.setLength(0);
        for (String unicode : nonUnicodeSample) {
            sb.append(EmoticonUtils.unicodeToUTF16(unicode));
            boolean bRet = EmoticonUtils.hasEmoticon(sb);
            Assert.assertFalse(bRet);
        }
    }
}
